package com.kingwang.study.spring.security.demo.security.handler;

import com.kingwang.study.spring.security.demo.util.HttpServletUtils;
import org.springframework.http.HttpStatus;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * FormLogin认证成功的处理器
 */
public class FormLoginAuthenticationSuccessHandler implements AuthenticationSuccessHandler {
    @Override
    public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
        HttpServletUtils.sendHttpStatusResponse(response, HttpStatus.OK);
    }
}
